
from common.base import Base
from common.base import open_browser
from page.buy_page import BuyPage
import time
class AccountPage(Base):

    buy_name_loc = ("class name", "f6")  # 购买名字
    number_loc = ("id", "goods_number_3512")  # 购买数量输入框
    clear_loc = ("xpath", "//*[@id='formCart']/table[2]/tbody/tr/td[2]/input[1]")  # 清空购物车按钮
    update_loc = ("xpath", "//*[@id='formCart']/table[2]/tbody/tr/td[2]/input[2]")  # 更新购物车按钮
    account_loc = ("xpath", "/html/body/div[6]/div[1]/table/tbody/tr/td[2]/a/img")  # 去结算按钮
    con_loc = ("xpath", "/html/body/div[6]/div[1]/table/tbody/tr/td[1]/a/img")  # 继续购物按钮
    order_loc = ("xpath","//*[@id='theForm']/div[15]/div[2]/input[1]")  # 定位提交订单

    def input_number(self,text):
        # 购买数量输入
        self.send_keys(self.number_loc,text)
    def click_clear(self):
        # 点击清空购物车
        self.click(self.clear_loc)
    def click_update(self):
        # 点击更新购物车
        self.click(self.update_loc)
    def click_account(self):
        # 点击去结算按钮
        self.click(self.account_loc)
    def click_con(self):
        # 点击继续购物
        self.click(self.con_loc)
    def click_order(self):
        # 点击提交订单
        self.click(self.order_loc)
